package Hash;

public class CanConstruct383 {
    public boolean canConstruct(String ransomNote, String magazine) {
        int[] array = new int[26];
        for (char c : magazine.toCharArray()) {
            array[c - 'a'] += 1;
        }

        for (char c : ransomNote.toCharArray()) {
            array[c - 'a'] -= 1;
        }

        for (int i : array) {
            if(i < 0){
                return false;
            }
        }

        return true;
    }
}
